{layout name="../common/master"/}
<div id="right">
       <h4 style="border-bottom: 1px solid #ccc;padding-bottom: 3px">推送历史列表   <a type="button" href="{:URL('home/Sms/smsAdd')}" class="btn btn-success">添加</a></h4>
    <!--<form action="" method="post" role="form">-->
        <!--<div class="form-group">-->
            <!--<input type="text" style="width: 200px;float: left;margin-right: 20px" class="form-control" value="{if condition='isset($uname)'}{$uname}{/if}" name="uname" id="" placeholder="上传名">-->
        <!--</div>-->
        <!--<button type="submit" class="btn btn-primary">查询</button>-->
        <!--<a href="{:URL('home/Docmanager/docupload')}" class="btn btn-success">上传文件</a>-->
    <!--</form>-->
    <table class="table-bordered table  table-hover" style="margin-top: 20px;">
        <thead>
        <tr>
            <th>ID</th>
            <th>推送内容</th>
            <th>状态</th>
            <th>平台</th>
            <th>推送时间</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
        {foreach name="data" item="vo" key="k"}
        <tr>
            <th>{$vo['id']}</th>
            <th>{$vo['smsTmp']}</th>
            {if condition="$vo['status'] eq 1"}
            <th>失败</th>
            {elseif condition="$vo['status'] eq 2"}
             <th>推送中</th>
            {elseif condition="$vo['status'] eq 3"}
             <th>成功</th>
            {/if}

            {if condition="$vo['status'] eq 1"}
            <th>短信</th>
            {elseif condition="$vo['status'] eq 2"}
            <th>APP</th>
            {else/}
            <th>无</th>
            {/if}
            <th>{:gmtToIndiaTime($vo['create_time'])}</th>
            <th>
                <a href="{:URL('home/Sms/pushInfo',['uid'=>$vo['id']])}" class="use btn btn-success">查看详情</a>
            </th>
        </tr>
        {/foreach}
        </tbody>
    </table>

</div>
<script>
    $(".toStore").click(function(){
        var data={
            is_valid:1
        }
        var id=$(this).attr('uid');
        var url="{:URL('home/Product/upStore')}"+"?id="+id;
        $.post(url,data,function(res){
            if(res.code == 0){
                location.reload();
            }else{
                layer.msg(res.data,function(){});
            }
        })
    })
    $(".downStore").click(function(){
        var data={
            is_valid:0
        }
        var id=$(this).attr('uid');
        var url="{:URL('home/Product/upStore')}"+"?id="+id;
        $.post(url,data,function(res){
            if(res.code == 0){
                location.reload();
            }else{
                layer.msg(res.data,function(){});
            }
        })
    })
    var url="{:URL('home/Sms/updateSms')}";
    $(".use").click(function(){
        var uid=$(this).attr('uid');
        var type=1;

        $.post(url,{uid:uid,type:type}, function (res) {
            if(res.code == 0){
                layer.msg(res.msg);
                location.href="{:URL('home/Sms/smsList')}";
            }else{
                layer.msg(res.data,function(){});
            }
        })
    })
    $(".unuse").click(function(){
        var uid=$(this).attr('uid');
        var type=0;
        $.post(url,{uid:uid,type:type}, function (res) {
            if(res.code == 0){
                layer.msg(res.msg);
                location.href="{:URL('home/Sms/smsList')}";
            }else{
                layer.msg(res.data,function(){});
            }
        })
    })
</script>
